<?php
//Xac dinh Recordtype
$v_recordtype_filter = $_SESSION['onegate_current_recordtype'];
if(isset($_REQUEST['hdn_recordtype_filter'])){
	$v_recordtype_filter = $_REQUEST['hdn_recordtype_filter'];
}

//File htm dung de hien thi noi dung thong bao thue
//Gan gia tri ban dau,de phong truong hop khong tim thay file
$v_file_name = "noi_dung_giay_phep.htm";

//Lay xml Noi dung thong bao thue
$v_xml_str =$arr_single_record_announce[0][2];
//echo htmlspecialchars($v_xml_str);
//file chua cac the can thay the
$v_receipt_xml_file = "../../xml/".$v_recordtype_filter."/mau_in_thong_bao_thue.xml";
if (file_exists($v_receipt_xml_file)){
	$v_receipt_xml_string = _read_file($v_receipt_xml_file);
}else{
	echo "<Center><B>"._CONST_NOT_FOUND_WORD."</B></Center>";
}
$table_struct_rax = new RAX(); 
$table_struct_rec = new RAX(); 
$table_struct_rax->open($v_receipt_xml_string);
$table_struct_rax->record_delim = 'application_form';
$table_struct_rax->parse();
$table_struct_rec = $table_struct_rax->readRecord(); 
$table_struct_row = $table_struct_rec->getRow();
//lay ten file html tu file xml :mau_in_giay_thong_bao_thue.xml
$v_file_name = $table_struct_row["file_name"];

$v_receipt_richtext_file = "../../template/" . $v_recordtype_filter . "/" . $v_file_name;
if(!file_exists($v_receipt_richtext_file)){
	$v_receipt_richtext_file = "../../template/" . $v_file_name;
}
$v_receipt_richtext_string = _read_file($v_receipt_richtext_file);
echo $v_richtext_output = Print_Receipt_From_XML($v_receipt_xml_string,$v_receipt_richtext_string,$v_xml_str,$arr_single_record);
?>